package com.pentalog.rest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
 
@Path("/xml/customer")
public class XMLService {
 
	// call : http://localhost:8080/rest-example/rest/xml/customer/query?name=Tuong&pin=123
	@GET
	@Path("/query")
	@Produces(MediaType.APPLICATION_XML)
	public Customer getQueryCustomerInXML(@QueryParam("name") String name, @QueryParam("pin") int pin) {
 
		Customer customer = new Customer();
		customer.setName(name);
		customer.setPin(pin);
 
		return customer;
 
	}
	
	// call : http://localhost:8080/rest-example/rest/xml/customer/Huan/1234
	@GET
	@Path("/{name}/{pin}")
	@Produces(MediaType.APPLICATION_XML)
	public Customer getCustomerInXML(@PathParam("name") String name, @PathParam("pin") int pin) {
 
		Customer customer = new Customer();
		customer.setName(name);
		customer.setPin(pin);
 
		return customer;
 
	}
 
}